//
//  InviteViewController.m
//  jingjing2.0
//
//  Created by apple on 16/5/17.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "InviteViewController.h"
#import "InviteFriendViewController.h"
@interface InviteViewController ()

@end

@implementation InviteViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    [self getData];
    self.shareView.layer.cornerRadius=8;
    self.shareView.clipsToBounds=YES;
    self.shareBtn.layer.cornerRadius=4;
    self.shareBtn.clipsToBounds=YES;
}

-(void)getData
{
  //http://192.168.1.107:3722/Common/PageInfo/{UserCode}/{PageType}/{ObjectID}/{Timestamp}/{Sign}
    NSString *timeStamp=[GeneralTool gettimestamp];
    NSDictionary *dic=@{@"UserCode":GETUSERCODE,
                        @"PageType":@"INVITE_PAGE_HOEM",
                        @"ObjectID":_categoryID,
                        @"Timestamp":timeStamp};
    NSString *sign=[GeneralTool GetSin:dic];
    NSString *urlString=[NSString stringWithFormat:@"Common/PageInfo/%@/%@/%@/%@/%@",GETUSERCODE,@"INVITE_PAGE_HOEM",_categoryID,timeStamp,sign];
    [RequestTool requestDataWithType:@"get" andUrlString:urlString andParameters:nil andRequestFinished:^(id responses, NSError *error) {
        if (error) {
            [MBProgressHUD showError:@"无法获取分享链接，请稍后再试"];
        }
        if ([responses[@"IsSuccess"]integerValue]==1) {
            NSDictionary *dic=responses[@"ReturnObject"];
            self.descriptionLbl.text=dic[@"Description"];
        }else
        {
            [MBProgressHUD showError:dic[@"ReturnString"]];
 
        }
        
    }];
    
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [GeneralTool hideTabBar];
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [GeneralTool showTabBar];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


- (IBAction)shareFriend:(id)sender {
    InviteFriendViewController *friend=[[InviteFriendViewController alloc]init];
    friend.title=@"净净洗衣邀请返利";
    friend.hidesBottomBarWhenPushed=YES;
    friend.categoryId=_categoryID;
    [self.navigationController pushViewController:friend animated:YES];
}



- (IBAction)AboutInviteRebate:(id)sender {
    WebViewController *web=[[WebViewController alloc]init];
    web.title=@"净净邀请返利";
    web.hidesBottomBarWhenPushed=YES;
    web.pageUrl=ABOUT_FANLI;
    [self.navigationController pushViewController:web animated:YES];

}
@end
